package 实用类作业.thirdthquestion;

import java.text.SimpleDateFormat;
import java.util.Scanner;

public class Commodity {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String[] goods={"电风扇","洗衣机","电视剧","冰箱","空调机"};
        double[] price={124.23,4500.0,8800.9,5000.88,4456.0};
        System.out.println("******欢迎进入商品批发城*******");
        System.out.println("编号\t商品\t\t价格");
        for (int i = 0; i <goods.length ; i++) {
            System.out.println((i+1)+"\t\t"+goods[i]+"\t\t"+price[i]);
        }
        System.out.println("请输入你批发的商品编号：");
        int id = scanner.nextInt();
        System.out.println("请输入批发数量");
        int num = scanner.nextInt();
        int sumPrice=(int)price[id]*num;
        String s=String.valueOf(sumPrice);
        StringBuilder  sb=new StringBuilder(s);
        for (int i = s.length()-3; i>=0 ; i-=3) {
            sb.insert(i,",");
        }
        System.out.println("您需要支付："+sb);
    }
}
